﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HpSocketIotGateway.Facade
{
    public class SplitPackageKey : IEquatable<SplitPackageKey>
    {

        public SplitPackageKey(string mn, string cn, DateTime datatime, int pnum)
        {
            this.mn = mn;
            this.cn = cn;
            this.datatime = datatime;
            this.pnum = pnum;
        }
        public string mn { get; set; }

        public string cn { get; set; }

        public DateTime datatime { get; set; }

        public int pnum { get; set; }

        public HashSet<int> ThePnos = new HashSet<int>();

        public DateTime CreateTime { get; set; }

        public override bool Equals(object obj)
        {
            var other = obj as SplitPackageKey;
            return other != null &&
                   mn.Equals(other.mn) &&
                   cn.Equals(other.cn) &&
                   datatime.Equals(other.datatime) &&
                   pnum == other.pnum;
        }

        public bool Equals(SplitPackageKey other)
        {
            return other != null &&
                   mn.Equals(other.mn) &&
                   cn.Equals(other.cn) &&
                   datatime.Equals(other.datatime) &&
                   pnum == other.pnum;
        }

        public override int GetHashCode()
        {
            var hashCode = -449473641;
            hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(mn);
            hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(cn);
            hashCode = hashCode * -1521134295 + datatime.GetHashCode();
            hashCode = hashCode * -1521134295 + pnum.GetHashCode();
            return hashCode;
        }
    }
}
